{extend name="web/official_common/pc/base" /}

{block name="css"}
<link href="__ADDON__/layui-v2.6.8/layui-v2.6.8/layui/css/layui.css" rel="stylesheet" type="text/css">
{/block}

{block name="content"}
<!--主体内容 开始-->
<div class="article">
 <!--右侧区域 开始-->
 <div id="right">
  <div class="right_title">
   <!--当前位置 开始-->
<!--   <div id="location">-->
<!--    <b>当前位置：</b>-->
<!--    <a href="/index.php" target="_self">网站首页</a> &nbsp;&gt;&gt;&nbsp;-->
<!--    <a href="#" target="_self">投递简历</a>-->
<!--   </div>-->
   <!--当前位置 结束-->
      <h2>
          <img src="__ADDON__/images/titleleftbg.png" align="absmiddle">{:__l('index','Position')} : <span style="color: #7b2c02">{$table['job_title']}</span>
          <img src="__ADDON__/images/titlerightbg.png" align="absmiddle">
      </h2>
  </div>
  <div class="right_body">
   <table class="resume_table">
    <form enctype="multipart/form-data" class="layui-form" id="frmResume">
    {:token()}
    <tbody>
      <tr class="layui-form-item">
        <th>
         <label class="layui-form-label">{:__l('table','Official_list_table_id')}</label>
        </th>
        <td class="layui-input-block">
          <input type="text" value="{$table['job_title']}" readonly="readonly" autocomplete="off" placeholder="{:__l('table','Fill in')}职位名称" class="layui-input">
          <input type="hidden" name="official_list_table_id" value="{$table['id']}">
        </td>
      </tr>

      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Name')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="name" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Name')}" class="layui-input">
       </td>
      </tr>

      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Gender')}</label>
       </th>
       <td class="layui-input-block">
        &nbsp;&nbsp;<input type="radio" name="gender" value="1" title="{:__l('table','Gender 1')}"  checked="">&nbsp;{:__l('table','Gender 1')}
        &nbsp;&nbsp;<input type="radio" name="gender" value="0" title="{:__l('table','Gender 0')}">&nbsp;{:__l('table','Gender 0')}
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Birthday')}</label>
       </th>
       <td class="layui-input-block">
           <input type="text" name="birthday" id="date" required lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Nationality')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="nationality" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Nationality')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Politics_status')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="politics_status" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Politics_status')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Education')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="education" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Education')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Native_place')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="native_place" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Native_place')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','School')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="school" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','School')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Discipline')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="discipline" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Discipline')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Phone')}</label>
       </th>
       <td class="layui-input-block">
        <input type="tel" name="phone" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Phone')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Email')}</label>
       </th>
       <td class="layui-input-block">
        <input type="email" name="email" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Email')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Address')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="address" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Address')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Treatment')}</label>
       </th>
       <td class="layui-input-block">
        <input type="text" name="treatment" required  lay-verify="required" autocomplete="off" placeholder="{:__l('table','Fill in')}{:__l('table','Treatment')}" class="layui-input">
       </td>
      </tr>
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('table','Detail_requirement')}</label>
       </th>
       <td class="layui-input-block">
        <textarea placeholder="{:__l('table','Fill in')}{:__l('table','Detail_requirement')}" name="detail_requirement" class="layui-textarea" required></textarea>
       </td>
      </tr>
      {if $captchaType}
      <tr class="layui-form-item">
       <th>
        <label class="layui-form-label">{:__l('index','Captcha')}</label>
       </th>
       <td class="layui-input-block">
           {include file="web/official_common/pc/captcha" event="register" type="$captchaType" /}
       </td>
      </tr>
      {/if}
      <tr class="layui-form-item">
          <td colspan="2" class="operation">
              <button class="form_button btn in_post" stu="1" type="button" lay-filter="demo1">{:__l('table','Deliver resume')}</button>
          </td>
      </tr>
    </tbody>
    </form>
   </table>
   <div class="page"></div>
  </div>
  <div class="right_bottom"></div>
 </div>
 <!--右侧区域 结束-->
 <div class="clear"></div>
</div>
<!--主体内容 结束-->

<style>
 .layui-textarea{
     margin-top: 5px !important;
 }
 .layui-input{
   margin-top: 5px !important;
 }
 .layui-form-label{
  text-align: left !important;
 }
</style>




{/block}

{block name="js"}
<script src="__ADDON__/layui-v2.6.8/layui-v2.6.8/layui/layui.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
 layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
          ,layer = layui.layer
          ,layedit = layui.layedit
          ,laydate = layui.laydate;
     //日期
     laydate.render({
         elem: '#date'
     });
  $('.in_post').click(function () {
      let that = this;
      let official_list_table_id = $("input[name='official_list_table_id']").val();
      let name = $("input[name='name']").val();
      let gender = $("input[name='gender']").val();
      let birthday = $("input[name='birthday']").val();
      let nationality = $("input[name='nationality']").val();
      let politics_status = $("input[name='politics_status']").val();
      let education = $("input[name='education']").val();
      let native_place = $("input[name='native_place']").val();
      let school = $("input[name='school']").val();
      let discipline = $("input[name='discipline']").val();
      let phone = $("input[name='phone']").val();
      let email = $("input[name='email']").val();
      let address = $("input[name='address']").val();
      let treatment = $("input[name='treatment']").val();
      let detail_requirement = $("textarea[name='detail_requirement']").val();
      let __token__ = $("input[name='__token__']").val();
      let captcha = $("input[name='captcha']").val();



      let stu = $('.in_post').attr('stu');
      if (stu != 1){
          layer.msg("{:__l('index','Do not click again')}");
      }


      if (!official_list_table_id){
          layer.msg("{:__l('table','Official_list_table_id')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!name){
          layer.msg("{:__l('table','Name')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!gender){
          layer.msg("{:__l('table','Gender')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!birthday){
          layer.msg("{:__l('table','Birthday')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!nationality){
          layer.msg("{:__l('table','Nationality')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!politics_status){
          layer.msg("{:__l('table','Politics_status')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!education){
          layer.msg("{:__l('table','Education')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!native_place){
          layer.msg("{:__l('table','Native_place')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!school){
          layer.msg("{:__l('table','School')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!discipline){
          layer.msg("{:__l('table','Discipline')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!phone){
          layer.msg("{:__l('table','Phone')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!email){
          layer.msg("{:__l('table','Email')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!address){
          layer.msg("{:__l('table','Address')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!treatment){
          layer.msg("{:__l('table','Treatment')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!detail_requirement){
          layer.msg("{:__l('table','Detail_requirement')}"+"{:__l('index','No_empty')}");
          return false;
      }
      if (!captcha){
          layer.msg("{:__l('index','Captcha')}"+"{:__l('index','No_empty')}");
          return false;
      }

      var data = {
          official_list_table_id:official_list_table_id,
          name:name,
          gender:gender,
          birthday:birthday,
          nationality:nationality,
          politics_status:politics_status,
          education:education,
          native_place:native_place,
          school:school,
          discipline:discipline,
          phone:phone,
          email:email,
          address:address,
          treatment:treatment,
          detail_requirement:detail_requirement,
          captcha:captcha,
          __token__:__token__
      };

      $('.in_post').attr('stu',2);


      axios.post('', data)
          .then(function (response) {
              let data = response.data;
              $('.in_post').attr('stu',1);
              if(data.code){
                  //信息框-例1
                  layer.alert(data.msg, {icon: 6,title:"{:__l('index','Successful tip')}"});

                  $("input[name='official_list_table_id']").val('');
                  $("input[name='name']").val('');
                  $("input[name='gender']").val('');
                  $("input[name='birthday']").val('');
                  $("input[name='nationality']").val('');
                  $("input[name='politics_status']").val('');
                  $("input[name='education']").val('');
                  $("input[name='native_place']").val('');
                  $("input[name='school']").val('');
                  $("input[name='discipline']").val('');
                  $("input[name='phone']").val('');
                  $("input[name='email']").val('');
                  $("input[name='address']").val('');
                  $("input[name='treatment']").val('');
                  $("textarea[name='detail_requirement']").val('');
                  $("input[name='captcha']").val('');
                  return false;
              }
              //信息框-例1
              layer.msg(data.msg, {icon: 5},function(){
                  axios.get("{:addon_url('official/web.official_home/get_token')}", data)
                  .then(function (response) {
                      let res = response.data;
                      if (res.code == 1){
                          $("input[name='__token__']").val(res.data)
                      }
                  })
              });
          })
          .catch(function (error) {
              console.log(error);
          });
  })
 });
</script>
{/block}
